package com.wxy.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wxy.dao.userMapper;
import com.wxy.domain.user;



@Service
public class registerService {
	private static final Logger LOGGER=LoggerFactory.getLogger(registerService.class);
	@Autowired
	private userMapper userMapper;
	public boolean insertUser(user user) {
		//判断用户名是否存在，存在直接返回false
		if(userMapper.findUserByUsername(user.getUsername())!=null) {
			LOGGER.info("用户名已存在...");
			return false;}
		int num=userMapper.insertUser(user);
		if(num!=0) {
			LOGGER.info("注册成功...");
			return true;
		}
		return false;
	}
}
